package com.corpgovernment;


import com.alicp.jetcache.anno.config.EnableMethodCache;
import com.github.pagehelper.PageHelper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import tk.mybatis.spring.annotation.MapperScan;

import java.util.Properties;

/**
 * @author qkdong
 */
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class,scanBasePackages = {"com.corpgovernment", "com.ctrip.corp.obt.falconcache","com.alicp.jetcache.anno","com.excel", "com.ctrip.corp.obt.shard.service"})
@EnableDiscoveryClient
@EnableFeignClients("com.corpgovernment")
@EnableTransactionManagement
@MapperScan(basePackages = {"com.corpgovernment.**.mapper","com.excel.mapper"})
@EnableScheduling
@EnableMethodCache(basePackages = "com.corpgovernment")
public class OrganizationManageApplication {

    public static void main(String[] args) {
        Long startTime = System.nanoTime();
        System.setProperty("java.awt.headless", "true");
        SpringApplication.run(OrganizationManageApplication.class, args);
        Long endTime = System.nanoTime();
        System.out.println("启动耗时-----------------"+(endTime-startTime)/1000/1000+"---------ms-----");
    }


    @Bean
    public PageHelper pageHelper() {
        PageHelper pageHelper = new PageHelper();
        Properties properties = new Properties();
        properties.setProperty("offsetAsPageNum", "true");
        properties.setProperty("rowBoundsWithCount", "true");
        properties.setProperty("reasonable", "true");
        //配置mysql数据库的方言
        properties.setProperty("dialect", "mysql");
        pageHelper.setProperties(properties);
        return pageHelper;
    }
}
